import csv
import os

# 读取csv数据函数
# file_name：文件名
# line_num：数据所在行，取值范围为 1~n
# row_num：数据所在列，取值范围为 1~n
def read_csv_data(file_name, line_num, row_num):
    base_url = os.path.dirname(os.path.dirname(__file__))
    file = os.path.join(base_url, file_name)
    line_num = line_num - 1
    row_num = row_num - 1

    with open(file, 'r', encoding='utf-8') as csvfile:
        data = csv.reader(csvfile)
        for i, info in enumerate(data):
            if i == line_num:
                return info[row_num]